<template>
  <basic-container>
    <avue-crud v-bind="bindVal"
               v-on="onEvent"
               :page.sync="page"
               v-permission="{delBtn: 'OSS_DELETE',addBtn: 'OSS_ADD',editBtn: 'OSS_UPDATE'}"
               v-model="form">

      <template slot="menuLeft" slot-scope="scope">
        <el-button type="danger" v-permission="'OSS_DELETE'" icon="el-icon-delete" size="small" @click.stop="deletes()">批量删除</el-button>
      </template>

      <template slot="category" slot-scope="scope">
        <el-tag>{{scope.row.params.category}}</el-tag>
      </template>

      <template slot="code" slot-scope="scope">
        <b @click="copyCode(scope.row.code)" :style="{color: colorName,cursor: 'pointer'}">{{scope.row.code}}</b>
      </template>

    </avue-crud>

  </basic-container>
</template>

<script>


import {mapGetters} from "vuex";

export default window.$crudCommon({
  data () {
    return {
    }
  },
  created () {
  },
  computed: {
    ...mapGetters(["colorName"])
  },
  methods: {
    copyCode(code) {
      this.$Clipboard({
        text: code
      }).then(() => {
        this.$message.success('复制成功')
      }).catch(() => {
        this.$message.error('复制失败')
      });
    }
  }
}, {
  name: '/resource/oss',
  data: 'list'
})
</script>

<style lang="scss" scoped>
</style>